{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9b655edc-7b6f-4728-9a16-dfa41864e4b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['haar',\n",
       " 'db',\n",
       " 'sym',\n",
       " 'coif',\n",
       " 'bior',\n",
       " 'rbio',\n",
       " 'dmey',\n",
       " 'gaus',\n",
       " 'mexh',\n",
       " 'morl',\n",
       " 'cgau',\n",
       " 'shan',\n",
       " 'fbsp',\n",
       " 'cmor']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pywt\n",
    "pywt.families()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "08525f59-3802-42ab-a534-5ada38c58288",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "haar family: haar\n",
      "db family: db1, db2, db3, db4, db5, db6, db7, db8, db9, db10, db11, db12, db13, db14, db15, db16, db17, db18, db19, db20, db21, db22, db23, db24, db25, db26, db27, db28, db29, db30, db31, db32, db33, db34, db35, db36, db37, db38\n",
      "sym family: sym2, sym3, sym4, sym5, sym6, sym7, sym8, sym9, sym10, sym11, sym12, sym13, sym14, sym15, sym16, sym17, sym18, sym19, sym20\n",
      "coif family: coif1, coif2, coif3, coif4, coif5, coif6, coif7, coif8, coif9, coif10, coif11, coif12, coif13, coif14, coif15, coif16, coif17\n",
      "bior family: bior1.1, bior1.3, bior1.5, bior2.2, bior2.4, bior2.6, bior2.8, bior3.1, bior3.3, bior3.5, bior3.7, bior3.9, bior4.4, bior5.5, bior6.8\n",
      "rbio family: rbio1.1, rbio1.3, rbio1.5, rbio2.2, rbio2.4, rbio2.6, rbio2.8, rbio3.1, rbio3.3, rbio3.5, rbio3.7, rbio3.9, rbio4.4, rbio5.5, rbio6.8\n",
      "dmey family: dmey\n",
      "gaus family: gaus1, gaus2, gaus3, gaus4, gaus5, gaus6, gaus7, gaus8\n",
      "mexh family: mexh\n",
      "morl family: morl\n",
      "cgau family: cgau1, cgau2, cgau3, cgau4, cgau5, cgau6, cgau7, cgau8\n",
      "shan family: shan\n",
      "fbsp family: fbsp\n",
      "cmor family: cmor\n"
     ]
    }
   ],
   "source": [
    "for family in pywt.families():\n",
    "    print(\"%s family: \" % family + ', '.join(pywt.wavelist(family)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7fd6d8ae-8633-469e-a9bb-3af9b004aa19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelet db3\n",
      "  Family name:    Daubechies\n",
      "  Short name:     db\n",
      "  Filters length: 6\n",
      "  Orthogonal:     True\n",
      "  Biorthogonal:   True\n",
      "  Symmetry:       asymmetric\n",
      "  DWT:            True\n",
      "  CWT:            False\n"
     ]
    }
   ],
   "source": [
    "# Creating Wavelet objects\n",
    "w = pywt.Wavelet('db3')\n",
    "# Wavelet properties\n",
    "print(w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "efbdfa74-8e37-41ac-b9c2-9f6e1425c984",
   "metadata": {},
   "outputs": [],
   "source": [
    "def print_array(arr):\n",
    "    print(\"[%s]\" % \", \".join([\"%.14f\" % x for x in arr]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "28f19632-25c4-4e41-9248-2e856ffd69aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w.filter_bank == (w.dec_lo, w.dec_hi, w.rec_lo, w.rec_hi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4ab6cef1-8516-4022-a03a-f5390c9b1ab1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelet My Haar Wavelet\n",
      "  Family name:\n",
      "  Short name:\n",
      "  Filters length: 2\n",
      "  Orthogonal:     False\n",
      "  Biorthogonal:   False\n",
      "  Symmetry:       unknown\n",
      "  DWT:            True\n",
      "  CWT:            False\n"
     ]
    }
   ],
   "source": [
    "class MyHaarFilterBank(object):\n",
    "    @property\n",
    "    def filter_bank(self):\n",
    "        from math import sqrt\n",
    "        return ([sqrt(2)/2, sqrt(2)/2], [-sqrt(2)/2, sqrt(2)/2],[sqrt(2)/2, sqrt(2)/2], [sqrt(2)/2, -sqrt(2)/2])\n",
    "    \n",
    "my_wavelet = pywt.Wavelet('My Haar Wavelet', filter_bank=MyHaarFilterBank())\n",
    "print(my_wavelet)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "35990dfd-8953-4475-8921-7e36bdb50276",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "w = pywt.Wavelet('sym3')\n",
    "print(w.orthogonal)\n",
    "(phi, psi, x) = w.wavefun(level=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1528791a-fbe5-45cf-9fa2-e2f3c8907f8c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "w = pywt.Wavelet('bior1.3')\n",
    "print(w.orthogonal)\n",
    "(phi_d, psi_d, phi_r, psi_r, x) = w.wavefun(level=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "33f869f0-6550-4352-b4ca-a6f7a8589fef",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
